﻿/**********************************弘石项目*******************************************
* 功能描述:项目管理
* 作者:石锦涛
* 时间:2021-12-7
* 
**********************************弘石项目*******************************************/
using HongStone.Domain.OperationsManagement;
using HongStone.Domain.SystemSetupModel.FrequentlyUsedDataModel;
using HongStone.Domain.SystemSetupModel.InstitutionSettingModel;
using HongStone.Dto;
using HongStone.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HongStone.Service
{
    public class OperationBll
    {
        private readonly OperationDal _operationDal;
        public OperationBll(OperationDal operationDal)
        {
            _operationDal = operationDal;
        }

        /// <summary>
        /// 字典下拉框数据
        /// </summary>
        /// <returns></returns>
        public ResultData Showdictionaries()
        {
            try
            {
                var query = _operationDal.Showdictionaries();
                return _operationDal.Showdictionaries();
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        ///  合同关联
        /// </summary>
        /// <returns></returns>
        public ResultData ShowContract(out int totalCount, string cname, int pageindex = 1, int pagesize = 5)
        {
            try
            {
                return _operationDal.ShowContract(out totalCount, cname, pageindex, pagesize);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 承接部门
        /// </summary>
        /// <returns></returns>
        public ResultData ShowCJSection(out int totalCount, int pageindex = 1, int pagesize = 5)
        {
            try
            {
                return _operationDal.ShowCJSection(out totalCount, pageindex, pagesize);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 甲方负责人
        /// </summary>
        /// <returns></returns>
        public ResultData ShowFirstParty(out int totalCount, string xname, string bumen, string phone, int pageindex = 1, int pagesize = 5)
        {
            try
            {
                return _operationDal.ShowFirstParty(out totalCount, xname, bumen, phone, pageindex, pagesize);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 执行设总
        /// </summary>
        /// <returns></returns>
        public ResultData ShowSZExecute(out int totalCount, string zname, int bumen, string phone, int pageindex = 1, int pagesize = 5)
        {
            try
            {
                return _operationDal.ShowSZExecute(out totalCount, zname, bumen, phone, pageindex, pagesize);

            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 立项结构样式
        /// </summary>
        /// <returns></returns>
        public List<StructureXMDto> ShowStructure()
        {
            try
            {
                return _operationDal.ShowStructure();
            }
            catch (Exception)
            {

                throw;
            }
        }

         /// <summary>
        /// 建筑分类
        /// </summary>
        /// <returns></returns>
        public List<ArchitectureXMDto> ShowArchitecture()
        {
            try
            {
                return _operationDal.ShowArchitecture();
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 添加项目立项
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        public int AddProjectLX(Project project)
        {
            try
            {
                return _operationDal.AddProjectLX(project);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 显示项目信息
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="bumen"></param>
        /// <param name="xmName"></param>
        /// <param name="jsClass"></param>
        /// <param name="jsgm"></param>
        /// <param name="jsgms"></param>
        /// <param name="jsdanwei"></param>
        /// <param name="jgxs"></param>
        /// <param name="jzflei"></param>
        /// <param name="zxsez"></param>
        /// <param name="jiafz"></param>
        /// <param name="hte"></param>
        /// <param name="htes"></param>
        /// <param name="didian"></param>
        /// <param name="xinzhi"></param>
        /// <param name="laiyuan"></param>
        /// <param name="begtime"></param>
        /// <param name="begtimes"></param>
        /// <param name="endtime"></param>
        /// <param name="endtimes"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public ResultData ShowProject(out int totalCount, int? bumen, string xmName, int? jsClass, decimal? jsgm, decimal? jsgms, string jsdanwei, string jgxs, string jzflei, string zxsez, string jiafz, decimal? hte, decimal? htes, string didian, int? xinzhi, int? laiyuan, DateTime? begtime, DateTime? begtimes, DateTime? endtime, DateTime? endtimes, int pageindex = 1, int pagesize = 10)
        {
            try
            {
                return _operationDal.ShowProject(out totalCount, bumen, xmName, jsClass, jsgm, jsgms, jsdanwei, jgxs, jzflei, zxsez, jiafz, hte, htes, didian, xinzhi, laiyuan, begtime, begtimes, endtime, endtimes, pageindex, pagesize);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public int DeletProject(string pid)
        {
            try
            {
                return _operationDal.DeletProject(pid);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 查看详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResultData BianJi(int id)
        {
            try
            {
                return _operationDal.BianJi(id);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 详情导出
        /// </summary>
        /// <param name="idc"></param>
        /// <returns></returns>
        public ResultData DaochuXQ(int idc)
        {
            try
            {
                
                return _operationDal.DaochuXQ(idc);

            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 项目信息修改
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        public int ProjeUpdate(Project project)
        {
            try
            {
                return _operationDal.ProjeUpdate(project);
            }
            catch (Exception)
            {

                throw;
            }

        }

        /// <summary>
        /// 显示项目关联合同
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="bumen"></param>
        /// <param name="xmName"></param>
        /// <param name="endtime"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public ResultData ShowContractLinkage(out int totalCount, int? bumen, string xmName, DateTime? rtime, DateTime? endtime, int pageindex = 1, int pagesize = 10)
        {
            try
            {
                return _operationDal.ShowContractLinkage(out totalCount, bumen, xmName, rtime, endtime, pageindex, pagesize);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 承接部门
        /// </summary>
        /// <returns></returns>
        public List<Department> Showbumen()
        {
            try
            {
                return _operationDal.Showbumen();
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 部门 项目统计
        /// </summary>
        /// <returns></returns>
        public List<ProjectStatisticsDto> ShowStatistics(int bu)
        {
            try
            {
                return _operationDal.ShowStatistics(bu);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 项目 季度 统计
        /// </summary>
        /// <param name="bu"></param>
        /// <returns></returns>
        public List<ProjectStatisticsDto> ShowQuarter(int bu)
        {
            try
            {

                return _operationDal.ShowQuarter(bu);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 项目 月度 统计
        /// </summary>
        /// <param name="bu"></param>
        /// <returns></returns>
        public List<ProjectStatisticsDto> Showmonthly(int bu)
        {
            try
            {

                return _operationDal.Showmonthly(bu);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 项目进度统计
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="bumen"></param>
        /// <param name="xmName"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public ResultData ShowSchedule(out int totalCount, int? bumen, string xmName, int pageindex = 1, int pagesize = 10)
        {
            try
            {
                return _operationDal.ShowSchedule(out totalCount, bumen, xmName, pageindex, pagesize);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 人员展示
        /// </summary>
        /// <returns></returns>
        public List<Staff> ShowMember()
        {
            try
            {
                return _operationDal.ShowMember();
            }
            catch (Exception)
            {

                throw;
            }
        }


    }

}
